//
//  GKZYRecommendTableViewCell.m
//  GKZYAid
//
//  Created by Tony Zhang on 16/3/15.
//  Copyright © 2016年 GKZYAid. All rights reserved.
//

#import "GKZYRecommendTableViewCell.h"
#import "MyDefine.h"

@implementation GKZYRecommendTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
    }
    return self;
}


-(void)configureTheCellWithModel:(GKZYRecommentSchoolModel *)model andOrder:(NSInteger)order{

    UILabel *orderLab = [[UILabel alloc]initWithFrame:CGRectMake(10, 25,30, 30)];
    orderLab.backgroundColor = [UIColor orangeColor];
    orderLab.textColor = [UIColor whiteColor];
    orderLab.text = [NSString stringWithFormat:@"%ld",(long)order+1];
    orderLab.textAlignment = NSTextAlignmentCenter;
    orderLab.layer.cornerRadius = 5;
    orderLab.layer.masksToBounds = YES;
    [self addSubview:orderLab];
    
    UILabel *schoolNameLab = [[UILabel alloc]initWithFrame:CGRectMake(45, 10, KmainScreenBoundsWidth/2, 30)];
    schoolNameLab.text = model.sch_name;
    schoolNameLab.textColor = [UIColor orangeColor];
    [self addSubview:schoolNameLab];
    
    UILabel *gradeLab = [[UILabel alloc]init];
    gradeLab.font = [UIFont systemFontOfSize:14];
    NSString *string = @"学校评级: ";
    CGSize size = [string sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:gradeLab.font,NSFontAttributeName, nil]];
    gradeLab.frame = CGRectMake(KmainScreenBoundsWidth/2+45, 10, size.width, 30);
    gradeLab.text = string;
    [self addSubview:gradeLab];
    
    UILabel *schoolGradeLab = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(gradeLab.frame), 10, 60, 30)];
    schoolGradeLab.text = model.sch_rank_name;
    schoolGradeLab.textColor = [UIColor orangeColor];
    [self addSubview:schoolGradeLab];
    
    UILabel *locationLab = [[UILabel alloc]initWithFrame:CGRectMake(45, 40, KmainScreenBoundsWidth/2, 30)];
    locationLab.text = [NSString stringWithFormat:@"学校坐落城市:%@",model.city_name];
    locationLab.font = [UIFont systemFontOfSize:14];
    locationLab.textColor = DeepCustomGrayColor;
    [self addSubview:locationLab];
    
    UILabel *scoreLab = [[UILabel alloc]initWithFrame:CGRectMake(KmainScreenBoundsWidth/2+45, 40, KmainScreenBoundsWidth/2-45, 30)];
    if ([model.avg_score intValue] == -1) {
        scoreLab.text = @"录取平均分:--";
    }else{
        scoreLab.text = [NSString stringWithFormat:@"录取平均分:%@",model.avg_score];
    }
    scoreLab.font = [UIFont systemFontOfSize:14];
    [self addSubview:scoreLab];
    
}



@end
